package org.potomak.patientmanager.beans.model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class CheckUpBean implements Serializable {

	private int id;
	private PatientBean patient;
	private Double weight;
	private Date date;

	public CheckUpBean() {
		patient = new PatientBean();
		weight = 0.0;
		date = new Date();
	}

	public CheckUpBean(PatientBean patient, Double weight, Date date) {
		this.patient = patient;
		this.weight = weight;
		this.date = date;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public PatientBean getPatient() {
		return patient;
	}

	public void setPatient(PatientBean patient) {
		this.patient = patient;
	}

	public Double getWeight() {
		return weight;
	}

	public void setWeight(Double weight) {
		this.weight = weight;
	}
	
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String toString() {
		return "patient: " + patient.getName() + " weight: " + weight + " date: " + (new SimpleDateFormat("dd/MM/yyyy")).format(date);
	}
        
        public boolean equals(Object o) {
            if(o instanceof CheckUpBean) {
                CheckUpBean cub = (CheckUpBean)o;
                return cub.getPatient().getName().equals(patient.getName()) && cub.getWeight().equals(weight) && cub.getDate().equals(date);
            }
            return false;
        }

}